package com.edu.eduoss.controller;

import com.edu.commonutils.R;
import com.edu.eduoss.service.OssService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

//@CrossOrigin
@Api(description = "对象存储接口")
@Controller
@RequestMapping("/eduoss/oss")
public class OssController {

    @Autowired
    private OssService ossService;

    @PostMapping("/fileupload")
    @ResponseBody
    public R fileupload(
            MultipartFile file){
        String fileupload = this.ossService.fileupload(file);
        return R.ok().data("url",fileupload);
    }

}
